package com.dolittle.test;

@SuppressWarnings("rawtypes")
public class Word implements Comparable {

	private String spanish;
	private String swedish;

	public Word(String swedish, String spanish) {
		this.setSpanish(spanish.toLowerCase().trim());
		this.setSwedish(swedish.toLowerCase().trim());
	}

	public String getSpanish() {
		return spanish;
	}

	public void setSpanish(String spanish) {
		this.spanish = spanish;
	}

	public String getSwedish() {
		return swedish;
	}

	public void setSwedish(String swedish) {
		this.swedish = swedish;
	}

	@Override
	public boolean equals(Object o) {
		if (o instanceof Word) {
			Word other = (Word) o;
			if ((other.getSpanish().equals(spanish))) {
				if (other.getSwedish().equals(swedish)) {
					return true;
				}
			}
		}
		return false;
	}

	public String write() {
		return swedish + "\n" + spanish + "\n";
	}

	@Override
	public int hashCode() {
		JenkinsHash jenk = new JenkinsHash();
		return (int) jenk.hash(swedish.getBytes());
	}

	@Override
	public String toString() {
		return swedish + " = " + spanish;
	}

	@Override
	public int compareTo(Object another) {
		return swedish.compareTo(((Word) another).getSwedish());

	}
}
